{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e9a07b2f-ee2b-4e91-9c23-e8e6a5d01223",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/reorder-list\n",
    "\n",
    "\n",
    "Runtime: 12 ms, faster than 33.54% of Go online submissions for Reorder List.\n",
    "Memory Usage: 6.8 MB, less than 6.21% of Go online submissions for Reorder List.\n",
    "\n",
    "\n",
    "```go\n",
    "/**\n",
    " * Definition for singly-linked list.\n",
    " * type ListNode struct {\n",
    " *     Val int\n",
    " *     Next *ListNode\n",
    " * }\n",
    " */\n",
    "func reorderList(head *ListNode) {\n",
    "    //7:09\n",
    "\tnode := head\n",
    "\tl := make([]*ListNode, 0)\n",
    "\tfor node != nil {\n",
    "\t\tl = append(l, node)\n",
    "\t\tnode = node.Next\n",
    "\t}\n",
    "\tnew_l := make([]*ListNode, 0)\n",
    "\tfor index, _ := range l {\n",
    "\t\tif index > len(l)-index-1 {\n",
    "\t\t\tbreak\n",
    "\t\t}\n",
    "\t\tif index == len(l)-index-1 {\n",
    "\t\t\tnew_l = append(new_l, l[index])\n",
    "\t\t}\n",
    "\t\tnew_l = append(new_l, l[index])\n",
    "\t\tnew_l = append(new_l, l[len(l)-index-1])\n",
    "\t}\n",
    "\tfor index, node := range new_l {\n",
    "\t\tif index == len(new_l)-1 {\n",
    "\t\t\tnode.Next = nil\n",
    "\t\t} else {\n",
    "\t\t\tnode.Next = new_l[index+1]\n",
    "\t\t}\n",
    "\t}\n",
    "\t//7:15\n",
    "}\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fe09cbe3-232c-4670-8531-b7749dd59f5b",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Go",
   "language": "go",
   "name": "gophernotes"
  },
  "language_info": {
   "codemirror_mode": "",
   "file_extension": ".go",
   "mimetype": "",
   "name": "go",
   "nbconvert_exporter": "",
   "pygments_lexer": "",
   "version": "go1.14.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
